﻿/*
Why not Ac it 
Time Limit:1000MS  Memory Limit:32768K


Description:
To be accepted is not a dream, but I don’t want to “waterify” this question. :-)
Hence a compromise needs to be made. 
Given an integer N, you are asked to print all its positive factors
in a consecutive way with small factors occurring before large factors.

Input:
The first line of input contains a number T (1<T<50), which is the number of test cases.
Each of the following T lines contains a single integer N (1<N<100). 
Output:
For each test case, print a line the string formed by N’s factors. 
Sample Input:
2
12
89
Sample Output:
1234612
189
*/
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
	for (unsigned t; cin>>t && (t>1 && t<50);)
	{
		while (t--)
		{
			unsigned n;
			cin>>n;
			vector<int> v;
			v.reserve(n/2);
			unsigned step=1;
			if(n&0x1U)
				step=2;
			
			for (unsigned d=1; d*d<=n; d+=step)
			{
				if(0==n%d)
				{
					cout<<d;
					v.push_back(n/d);
				}
			}
			for (vector<int>::reverse_iterator rit=v.rbegin(); rit!=v.rend(); ++rit)
				cout<<(*rit);
			cout<<endl;
		}
	}

	return EXIT_SUCCESS;
}